package com.h2cloud.controller;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Objects;

/**
 * @author: wulongkai
 * @create: 2022-10-20 11:11
 **/
class kv {
    String key;
    String value;



    public kv(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        kv kv = (kv) o;
        return Objects.equals(key, kv.key) && Objects.equals(value, kv.value);
    }


    public static void main(String[] args) {

////        Integer
//        String s = "longkai";
//        String s2 = "longkai";
//
////        kv kv = new kv("key1", "value1");
////        kv kv2 = new kv("key1", "value1");
////        System.out.println(kv.equals(kv2));
////        System.out.println(s.equals(s2));
//        List<Integer> lists = new ArrayList<>();
//        for (Integer i : lists) {
//            System.out.println(i);
//        }
//        long l = HashUtil.mixHash("421182199312111325");
//        System.out.println("l = " + l);

        kv l = new kv("key1", "value1");
        try {
            Field field = kv.class.getDeclaredField("key");
            field.setAccessible(true);
            Object o = field.get(l);
            System.out.println("o = " + o);

            Method getKey = kv.class.getDeclaredMethod("getKey");
            Object invoke = getKey.invoke(l);
            System.out.println("invoke = " + invoke);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
